package com.kly.user.enums;

import org.springframework.util.StringUtils;

/**
 * @author linqu
 */
public enum ReportType {

    NotMyType(1, "Not my type"),
    ItIsGuy(2, "Fake profile! It’s a guy"),
    AbusiveBehaviourOrNudity(3, "Abusive behaviour or nudity"),
    Scam(4, "Scam"),
    SexServices(5, "Sex services"),
    SaleOrMentionsOfDrugs(6, "Sale or mentions of drugs"),
    Underage(7, "Underage"),

    ;

    private final int type;

    private final String Value;

    ReportType(int type, String value) {
        this.type = type;
        Value = value;
    }

    public int getType() {
        return type;
    }

    public String getValue() {
        return Value;
    }



    public static ReportType fromType(int type) {
        for (ReportType reportType : values()) {
            if (reportType.getType() == type) {
                return reportType;
            }
        }
        throw new IllegalArgumentException("Invalid type: " + type);
    }

    public static ReportType fromValue(String value) {
        if (StringUtils.isEmpty(value)) {
            return null;
        }
        for (ReportType reportType : values()) {
            if (reportType.getValue().equals(value)) {
                return reportType;
            }
        }
        return null;
    }
}
